package com.xiaode.controller.admin.user;

import com.jfinal.aop.Inject;
import com.jfinal.core.Controller;
import com.jfinal.core.Path;
import com.jfinal.ext.cors.EnableCORS;
import com.jfinal.kit.Ret;
import com.xiaode.util.apidoc.annotation.Api;
import com.xiaode.util.apidoc.annotation.ApiOper;
import com.xiaode.util.apidoc.annotation.ApiPara;
import javax.validation.constraints.Size;

/**
 * 登录服务
 * 这里不用设置权限参数
 */
@Path("/aUser")
@Api("管理员信息相关服务")
@EnableCORS
public class UserController extends Controller {

    @Inject
    private UserService service;
    
	/**
	 * 修改密码
	 */
	@ApiOper("修改自己密码")
	public void changePassword(@Size(min = 6,max = 30) @ApiPara(value = "newPassword", notes = "新密码")String newPassword) throws Exception{
		Integer accountId = getAttr("accountId");
    	Ret ret = service.changeInfo(accountId,  newPassword);
    	renderJson(ret);
    }
	
	
	@ApiOper("查询老师")
	public void findAdmin() throws Exception{
    	Ret ret = service.findAdmin();
    	renderJson(ret);
    }

}